# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=peframe
pkgver=135.70683b6
pkgrel=8
groups=('blackarch' 'blackarch-malware' 'blackarch-binary'
        'blackarch-reversing')
pkgdesc='Tool to perform static analysis on (portable executable) malware.'
arch=('any')
url='https://github.com/guelfoweb/peframe'
license=('custom:unknown')
depends=('python' 'python-pefile' 'python-python-magic' 'python-oletools'
         'python-yara-python-dex' 'python-m2crypto' 'python-virustotal-api'
         'python-magic' 'python-msoffcrypto-tool' 'python-parameterized')
makedepends=('git' 'python-setuptools')
source=("git+https://github.com/guelfoweb/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  python setup.py install --root="$pkgdir" --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/README.md" README.rst

  rm README.rst

#  cp -a * "$pkgdir/usr/share/$pkgname/"

#  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
#cd /usr/share/$pkgname
#exec python3 $pkgname-cli.py "\$@"
#EOF

#  chmod a+x "$pkgdir/usr/bin/$pkgname"
}

